<?php session_start ();
require_once '../lib/sql.php';
$sql=new Sql();
$card;
if (isset ( $_SESSION ['card'] )) {
	$card = $_SESSION ['card'];
} else {
	$card=array();
}
$sum="";
if(isset($_REQUEST['id'])&&isset($_REQUEST['count'])){
	$id=$_REQUEST['id'];
	$count=$_REQUEST['count'];
	while (current($card)){
		$key=key($card);
		$sp=$card[$key];
		if($sp['id']==$id){
			$sp['count']=$count;
			$card[$key]=$sp;
			$_SESSION['card']=$card;
			$sum=($sp['count']*$sp['price'])." VNĐ";
			goto out;
		}
		next($card);
	}
}
out:echo $sum;

?>